const sql = require('mssql')

/**
 * 获取订货单数据接口
 */
const getOrderForm = (body) => {
  const startSql = `SELECT RQ,ID,DWBM,DWMC,JSFSBM,JSFSMC,ZSL,ZJE,JBRMC FROM DHD_ZB WHERE RQ <= '${body.RQ[1]} 23:59:59' AND RQ >= '${body.RQ[0]} 00:00:00'`
  return sql.query(startSql)
}

const getOrderFormTotal = (body) => {
  const startSql = `SELECT COUNT(ID) AS TOTAL FROM DHD_ZB WHERE RQ <= '${body.RQ[1]} 23:59:59' AND RQ >= '${body.RQ[0]} 00:00:00'`
  return sql.query(startSql)
}

module.exports = {
  getOrderForm,
  getOrderFormTotal
}
